package jmine.tec.persist.schema.association.set;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import jmine.tec.persist.annotation.Alias;
import jmine.tec.persist.schema.association.ValueEntity;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import bancosys.tec.component.Documentation;
import bancosys.tec.persist.bussobj.PersistableBusinessObject;

@Entity
@Alias("OWNER")
@Table(name = "OWNER")
@Documentation("TABELA OWNER")
@SequenceGenerator(name = "SEQ_OWNER", sequenceName = "SEQ_OWNER")
public class SetValueOwnerEntity extends PersistableBusinessObject {

    private Long id;

    private Set<ValueEntity> associations;

    /**
     * @return the id
     */
    @Id
    @GeneratedValue(generator = "SEQ_OWNER")
    @Column(name = "COD_OWNER", nullable = false)
    @Documentation("CODIGO OWNER")
    public Long getId() {
        return this.id;
    }

    /**
     * Seter id
     * 
     * @param id the id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the associations
     */
    @OneToMany
    public Set<ValueEntity> getAssociations() {
        return this.associations;
    }

    /**
     * @param associations the associations to set
     */
    public void setAssociations(Set<ValueEntity> associations) {
        this.associations = associations;
    }

    @Override
    public boolean equals(Object obj) {
        return EqualsBuilder.reflectionEquals(this, obj);
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
    }

}
